home *** CD-ROM | disk | FTP | other *** search
MarxMenu script | 1991-03-27 | 15.0 KB | 715 lines |
- Comment
- ==========================================================
-
- Copyright 1990-91 by Marc Perkel * All right reserved.
-
- This file is Computer Tyme's main system menu. It is written not
- only to be useful to us but to be an example of what can be done
- with MarxMenu.
-
- =========================================================
- EndComment
-
- ;------ Create Variables
-
- Var
- VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
- VertLine2 = "││││││││││││││││││││"
- VertLine3 = "┌─┴┴┴┴─┐"
- VertLine4 = "└─┬┬┬┬─┘"
- DefaultChoices = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- ThisDirectory
- MainChoices
- PrintQueueChoices
- PortChoices
- DosChoices
- MaintChoices
- NovUtilChoices
- NovUserChoices
- NovInfoChoices
- MainChoiceMask
- MyServer
- AllUsers
- NetAddress
- Station
- UserName
- BMess
- TitleBackColor
- TitleInsideColor
- UsersRead
-
-
- ;----- All environment string access will be the last Shell Environment
-
- ShellEnvironment
-
- ModifyPath Off
- OnScreenOnly
-
- MyServer = NovDefaultServer
- Station = Str(NovConnection)
- UserName = NovMyLoginName
-
- ;------ Read network address
-
- NetAddress = NovStationAddress (NovConnection)
-
- BMess = 'User: ' + UserName + ' * Server: ' + MyServer
- BMess = BMess + ' * Address: ' + NetAddress + ' * Dos: ' + DosVersionString
-
- ;------ Select colors and prepare screen
-
- SavePosition
- OnScreenOnly
- TitleBackColor = Brown
- TitleInsideColor = Yellow
- if ColorScreen
- TextColor Cyan Blue
- ClearScreen 176
- GotoXY 1 25
- TextColor Yellow Mag
- ClearLine
- WriteCenter BMess
- TextColor Blue Green
- GotoXY 4,4
- WriteVertical VertLine2
- GotoXY 5,4
- WriteVertical VertLine2
- GotoXY 6,4
- WriteVertical VertLine2
- GotoXY 7,4
- WriteVertical VertLine2
- GotoXY 74,4
- WriteVertical VertLine2
- GotoXY 75,4
- WriteVertical VertLine2
- GotoXY 76,4
- WriteVertical VertLine2
- GotoXY 77,4
- WriteVertical VertLine2
- GotoXY 2,4
- Write VertLine4
- GotoXY 72,4
- Write VertLine4
- GotoXY 2,24
- Write VertLine3
- GotoXY 72,24
- Write VertLine3
- BoxBorderColor White TitleBackColor
- BoxInsideColor TitleInsideColor TitleBackColor
- ClockColor TitleInsideColor TitleBackColor
- TextColor TitleInsideColor TitleBackColor
- else
- ClearScreen 176
- TextColor Black Grey
- GotoXY 1 25
- ClearLine
- ClearLine
- WriteCenter BMess
- BoxBorderColor Black Grey
- BoxInsideColor Black Grey
- ClockColor Black Grey
- endif
- SingleLineBox
- Explode Off
- DrawBox 1 1 80 3
- GotoXY (51,1)
- Write "Computer Tyme Master Menu"
- ClockPos 3 2
- DoubleLineBox
- ResetColors
-
- LockWord = ""
- BlankTime = 10
- UseArrows
- ThisDirectory = Path
-
- Comment
- ==========================================================
-
- I have defined a procedure called CenterStretchWindow which takes as
- parameters a menu title, array of choices, and the XY coordinants
- of the center of the window. CenterStretchWindow then displays all the
- choices and numbers them. This method allows me to update the menu
- more quickly.
-
- ==========================================================
- EndComment
-
- PrintQueueChoices[1] = 'Dot'
- PrintQueueChoices[2] = 'Laser'
- PrintQueueChoices[3] = 'Vicki'
- PrintQueueChoices[4] = 'Grace'
- PrintQueueChoices[5] = 'Nita'
- PrintQueueChoices[6] = 'Label'
-
- PortChoices[1] = 'Lpt1'
- PortChoices[2] = 'Lpt2'
- PortChoices[3] = 'Lpt3'
-
- ;----- Main Menu
-
- MainChoices[1] = 'Command Line'
- MainChoices[2] = 'Printer Select'
- MainChoices[3] = 'Personal Menu'
- MainChoices[4] = 'Create Disk Menu'
- MainChoices[5] = 'Maintenance Menu'
- MainChoices[6] = 'Format Disk Menu'
- MainChoices[7] = 'Dos Functions'
- MainChoices[8] = 'Novell Utilities'
- MainChoices[9] = 'Novell Information'
- MainChoices[10] = 'Novell User Options'
-
- MainChoiceMask = DefaultChoices
-
- Comment
- ==========================================================
-
- I have included a sample of how choices can be conditionally deleted
- from the men choices. The idea is to delete the choice from the
- selection array, and to insert a null character into MainChoiceMask at
- the position of the deleted choice. I recommend that choices be
- deleted from the end first working back to the beginning.
-
- ==========================================================
- EndComment
-
- if UserName <> 'MARC'
- delete(MainChoices,5,1)
- insert(char(0),MainChoiceMask,5)
- endif
-
- CornerStretchWindow ('Main Menu',MainChoices,11,6)
-
- OnKey Mid(MainChoiceMask,1,1)
- |if ExistOnPath('DOLIST.EXE') > ''
- DropTo DoList
- |else
- | Bat 'DropTo ' + ReadEnv('COMSPEC')
- |endif
-
- OnKey Mid(MainChoiceMask,2,1)
- |SelectPrintQueue
- |LastKey = ' '
-
- OnKey Mid(MainChoiceMask,3,1)
- |if ExistFile ('Z:' + UserName + '.MNU')
- | Bat 'Marx ' + UserName
- |endif
-
- OnKey Mid(MainChoiceMask,4,1)
- Marx MakeDisk
-
- OnKey Mid(MainChoiceMask,5,1)
- ^Maint
-
- OnKey Mid(MainChoiceMask,6,1)
- |SelectFormat
- |LastKey = ' '
-
- OnKey Mid(MainChoiceMask,7,1)
- ^Dos
-
- OnKey Mid(MainChoiceMask,8,1)
- ^NovUtils
-
- OnKey Mid(MainChoiceMask,9,1)
- ^NovInfo
-
- OnKey Mid(MainChoiceMask,10,1)
- ^NovUser
-
- OnKey Esc
- ^Leave
-
- ;----- Dos Menu
-
- :Dos
-
- DosChoices[1] = 'Memory Map'
- DosChoices[2] = 'Free Space'
- DosChoices[3] = 'Show Directory'
- DosChoices[4] = 'Pick Directory'
- DosChoices[5] = 'Directory Master'
-
- CornerStretchWindow ('DOS Menu',DosChoices,43,6)
-
- OnKey 'A'
- MapMem
- Pause
-
- OnKey 'B'
- Free
- Pause
-
- OnKey 'C'
- D/W
-
- OnKey 'D'
- PD
-
- OnKey 'E'
- |if ExistOnPath('DM3.EXE') > ''
- DropTo DM3
- |else
- DropTo DM
- |endif
-
-
- ;----- Maintenence Menu
-
- :Maint
-
- MaintChoices[1] = 'Clean Up Files'
- MaintChoices[2] = 'Tape Backup'
- MaintChoices[3] = 'Edit Login Menu'
- MaintChoices[4] = 'Delete .MRX Files'
- MaintChoices[5] = 'Edit this Menu'
-
- CornerStretchWindow ('Maintenence Menu',MaintChoices,43,6)
-
- OnKey 'A'
- Cleanup
-
- OnKey 'B'
- f:
- cd\public\jumbo
- Tape
- |Bat Left(ThisDirectory,2)
- |Bat 'cd ' + ThisDirectory
-
- OnKey 'C'
- L:
- me login.mnu
- marxcomp login
- |Bat Left(ThisDirectory,2)
- |Bat 'cd ' + ThisDirectory
-
- OnKey 'D'
- whereis *.mrx/d
- L:
- marxcomp login
- |Bat Left(ThisDirectory,2)
- |Bat 'cd ' + ThisDirectory
-
- OnKey 'E'
- me %MenuFileName
-
-
- ;----- Novell Utilities Menu
-
- :NovUtils
-
- NovUtilChoices[1] = 'Session Management'
- NovUtilChoices[2] = 'File Management'
- NovUtilChoices[3] = 'Volume Information'
- NovUtilChoices[4] = 'System Configuration'
- NovUtilChoices[5] = 'File Server Monitoring'
- NovUtilChoices[6] = 'Print Queue Management'
- NovUtilChoices[7] = 'Print Job Configurations'
- NovUtilChoices[8] = 'Printer Definitions'
- NovUtilChoices[9] = 'Folio Help System'
-
- CenterStretchWindow ('Novell Utilities',NovUtilChoices,45,16)
-
- OnKey 'A'
- Session
-
- OnKey 'B'
- Filer
-
- OnKey 'C'
- VolInfo
-
- OnKey 'D'
- Syscon
-
- OnKey 'E'
- FConsole
-
- OnKey 'F'
- PConsole
-
- OnKey 'G'
- PrintCon
-
- OnKey 'H'
- PrintDef
-
- OnKey 'I'
- P:Help
-
- ;----- Novell Information Menu
-
- :NovInfo
-
- NovInfoChoices[1] = 'UserList'
- NovInfoChoices[2] = 'Drive Map'
- NovInfoChoices[3] = 'Current Dir'
- NovInfoChoices[4] = 'Directory Rights'
- NovInfoChoices[5] = 'List Servers'
- NovInfoChoices[6] = 'Who Am I?'
- NovInfoChoices[7] = 'Trustees'
- NovInfoChoices[8] = 'System Time'
- NovInfoChoices[9] = 'ChkVol'
- NovInfoChoices[10] = 'Printer Status'
-
- CornerStretchWindow ('Novell Information',NovInfoChoices,43,6)
-
- OnKey 'A'
- UserList/A
- Echo.
- Pause
-
- OnKey 'B'
- Map
- Echo.
- Pause
-
- OnKey 'C'
- NDir
- Pause
-
- OnKey 'D'
- Rights
- Echo.
- Pause
-
- OnKey 'E'
- SList
- Echo.
- Pause
-
- OnKey 'F'
- WhoAmI/A
- Echo.
- Pause
-
- OnKey 'G'
- TList
- Echo.
- Pause
-
- OnKey 'H'
- SysTime
- Echo.
- Pause
-
- OnKey 'I'
- ChkVol
- Echo.
- Pause
-
- OnKey 'J'
- Capture Show
- Echo.
- Pause
-
- ;----- Novell User Menu
-
- :NovUser
-
- NovUserChoices[1] = 'Change Password'
- NovUserChoices[2] = 'Block Messages'
- NovUserChoices[3] = 'Receive Messages'
- NovUserChoices[4] = 'End Printer Capture'
- NovUserChoices[5] = 'Send a Message'
- NovUserChoices[6] = 'Lan Assist a User'
-
- CenterStretchWindow ('Novell User Menu',NovUserChoices,56,11)
-
- OnKey 'A'
- SetPass
-
- OnKey 'B'
- CastOff
-
- OnKey 'C'
- CastOn
-
- OnKey 'D'
- EndCap
-
- OnKey 'E'
- |SendMessage
-
- OnKey 'F'
- |Bat ('LA ' + PickUser('Lan Assist Who'))
-
- ;----- This routines selects a print queue
-
- Procedure SelectPrintQueue
- var Queue PrnPort QCmd
- CornerStretchWindow ('Print Queues',PrintQueueChoices,43,6)
- Queue = max(ord(ReadKey) - 64,1)
- Queue = UpperCase(PrintQueueChoices[Queue])
- if LastKey = Esc then Return
- CornerStretchWindow ('Port',PortChoices,44,17)
- PrnPort = Char(Ord(ReadKey) - 16)
- if LastKey = Esc then Return
- EraseTopWindow
- ClearScreen
- TextColor Yellow Blue
- Write ' Working '
- ResetColors
- ClearScreenFirst Off
- QCmd = 'Queue=' + Queue + ' C=1 NB NFF TimeOut=5 Local=' + PrnPort
- Execute('Capture ' + QCmd + '>nul')
- EndProc
-
- ;----- This routines selects floppy disk format
-
- Procedure SelectFormat
- var Ch Message Option BoxDim
- BoxDim[1] = 30
- BoxDim[2] = 12
- BoxDim[3] = 37
- BoxDim[4] = 4
- DrawStretchWindow('Format Floppy Disk Menu',BoxDim)
- Writeln ' 1 - Format 360 5 - Format /S 360'
- Writeln ' 2 - Format 1.2M 6 - Format /S 1.2M'
- Writeln ' 3 - Format 720 7 - Format /S 720'
- Write ' 4 - Format 1.4M 8 - Format /S 1.4M'
- Ch = ReadKey
- if Ch = '1'
- Message = '360k Format with no System Files.'
- Option = '/4'
- endif
- if Ch = '2'
- Message = '1.2m Format with no System Files.'
- Option = ''
- endif
- if Ch = '3'
- Message = '720k Format with no System Files.'
- Option = '/N:9/T:80'
- endif
- if Ch = '4'
- Message = '1.4m Format with no System Files.'
- Option = '/N:18/T:80'
- endif
- if Ch = '5'
- Message = '360k Format with System Files.'
- Option = '/4/S'
- endif
- if Ch = '6'
- Message = '1.2m Format with System Files.'
- Option = '/S'
- endif
- if Ch = '7'
- Message = '720k Format with System Files.'
- Option = '/N:9/T:80/S'
- endif
- if Ch = '8'
- Message = '1.4m Format with System Files.'
- Option = '/N:18/T:80/S'
- endif
- if Message = '' then Return
- BoxDim[1] = 56
- BoxDim[2] = 18
- BoxDim[3] = 5
- BoxDim[4] = 2
- DrawStretchWindow('Drive',BoxDim)
- Writeln ' A:'
- Write ' B:'
- Ch = ReadKey
- if Ch = Esc then Return
- if Ch = 'A'
- Bat '@Echo Formatting Drive A: ' + Message
- Bat '@Echo To abort, press CTRL-C.'
- Bat '@Echo .'
- Bat 'FORMAT A:' + Option
- endif
- if Ch = 'B'
- Bat '@Echo Formatting Drive B: ' + Message
- Bat '@Echo To abort, press CTRL-C.'
- Bat '@Echo .'
- Bat 'FORMAT B:' + Option
- endif
- EndProc
-
-
- Procedure SendMessage
- var BoxDim Choice Message
- Choice = PickUser('Send message To')
- BoxDim[1] = 14
- BoxDim[2] = 23
- BoxDim[3] = 52
- BoxDim[4] = 1
- DrawStretchWindow('Enter the Message that you Wish to Send',BoxDim)
- Write ' '
- Message = Readln
- if LastKey = Esc then Return
- ClearScreen
- TextColor Yellow Blue
- Write ' Sending ... '
- ClearScreenFirst Off
- Execute 'Send "' + Message + '" to ' + Choice + '>nul'
- ResetColors
- EndProc
-
-
- ;------ Reset Colors Procedure
-
- Procedure ResetColors
- if ColorScreen
- BoxBorderColor Yellow Blue
- BoxInsideColor Yellow Blue
- CapsColor White Blue
- InverseColor White Mag
- else
- BoxBorderColor Grey Black
- BoxInsideColor Grey Black
- CapsColor White Black
- endif
- EndProc
-
- ;----- This routines is used to actually draw the stretch window
-
- Procedure DrawStretchWindow (Title,BoxDim)
- Explode On
- DoubleLineBox
- DrawBox (BoxDim[1] - 2, BoxDim[2] - 3 ,BoxDim[3] + 6, BoxDim[4] + 4)
- TextColor LCyan Blue
- WriteCenter Title
- TextColor LGreen Blue
- Writeln
- ClearLine 196
- GotoXY 2 2
- WriteVertical mid(VertLine,1,BoxDim[4] + 1)
- ResetColors
- Explode Off
- NoBoxBorder
- Window (BoxDim[1] + 1, BoxDim[2], BoxDim[3] + 2, BoxDim[4])
- DoubleLineBox
- Explode On
- EndProc
-
- ;----- The X Y parameters are the center of the box
-
- Procedure CenterStretchWindow (Title, Choices, X, Y)
- var Longest BoxDim NumElem C
- Longest = length(Title) - 2
- NumElem = NumberOfElements(Choices)
- C = 64
- Loop NumElem
- Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
- Longest = Max(Longest,length(Choices[LoopIndex]))
- EndLoop
- BoxDim[1] = X - (Longest / 2) - 1
- BoxDim[2] = Y - (NumElem / 2) + 1
- BoxDim[3] = Longest
- BoxDim[4] = NumElem
- DrawStretchWindow(Title,BoxDim)
- Loop NumElem
- Write ' ' Choices[LoopIndex]
- if LoopIndex < NumElem then Writeln
- EndLoop
- EndProc
-
- ;----- The X Y parameters are the corner of the box
-
- Procedure CornerStretchWindow (Title, Choices, X, Y)
- var Longest BoxDim NumElem C
- Longest = length(Title) - 2
- NumElem = NumberOfElements(Choices)
- C = 64
- Loop NumElem
- Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
- Longest = Max(Longest,length(Choices[LoopIndex]))
- EndLoop
- BoxDim[1] = X + 2
- BoxDim[2] = Y + 3
- BoxDim[3] = Longest
- BoxDim[4] = NumElem
- DrawStretchWindow(Title,BoxDim)
- Loop NumElem
- Write ' ' Choices[LoopIndex]
- if LoopIndex < NumElem then Writeln
- EndLoop
- EndProc
-
- ;----- Recursive QuickSort
-
- Procedure SortUsers (L,R)
- var I J Middle
- I = L
- J = R
- Middle = AllUsers[(L+R)/2]
- repeat
- while AllUsers[I] < Middle
- I = I + 1
- endwhile
- while Middle < AllUsers[J]
- J = J - 1
- endwhile
- if I <= J
- Middle = AllUsers[J]
- AllUsers[J] = AllUsers[I]
- AllUsers[I] = Middle
- I = I + 1
- J = J - 1
- endif
- until I > J
- if (J - L) < (R - I)
- if L < J then SortUsers(L,J);
- if I < R then SortUsers(I,R);
- else
- if I < R then SortUsers(I,R);
- if L < J then SortUsers(L,J);
- endif
- EndProc
-
- ;----- Reads a list of all users on the system
-
- Procedure ReadUsers
- var I Name
- if UsersRead then Return
- I = 1
- Loop 20
- Name = NovLoginName (LoopIndex)
- if (Name > '') and (Name <> MyServer)
- AllUsers[I] = Name
- I = I + 1
- endif
- EndLoop
- SortUsers(1,NumberOfElements(AllUsers))
- UsersRead = True
- EndProc
-
- Procedure PickUser (Message)
- var BoxDim
- ReadUsers
- BoxDim[1] = 32
- BoxDim[2] = 14
- BoxDim[3] = 17
- BoxDim[4] = Min(8,NumberOfElements(AllUsers))
- DrawStretchWindow(Message,BoxDim)
- Return PickOne(AllUsers)
- EndProc
-
- ;------ MenuExit Procedure
-
- :Leave
- Explode On
- DrawBox 36 11 13 6
- TextColor LCyan Blue
- WriteCenter "Exit Menu"
- TextColor LGreen Blue
- Writeln
- ClearLine 196
- GotoXY 2 2
- WriteVertical mid(VertLine,1,3)
- ResetColors
- Explode Off
- NoBoxBorder
- DrawBox 39 14 9 2
- Writeln " Yes"
- Write " No"
- DoubleLineBox
- OnKey "Y"
- |ExitMenu
-
- OnKey "N"
- |LastKey = Esc
-